/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.com.etecmatao.model;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.Lob;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author admin
 */
@Entity
@Table(name = "professores")
@NamedQueries({
    @NamedQuery(name = "Professores.findAll", query = "SELECT p FROM Professores p"),
    @NamedQuery(name = "Professores.findByIdProfessores", query = "SELECT p FROM Professores p WHERE p.idProfessores = :idProfessores"),
    @NamedQuery(name = "Professores.findByNome", query = "SELECT p FROM Professores p WHERE p.nome = :nome"),
    @NamedQuery(name = "Professores.findByDescricaoAcademica", query = "SELECT p FROM Professores p WHERE p.descricaoAcademica = :descricaoAcademica"),
    @NamedQuery(name = "Professores.findByDataAdmissao", query = "SELECT p FROM Professores p WHERE p.dataAdmissao = :dataAdmissao"),
    @NamedQuery(name = "Professores.findByStatus", query = "SELECT p FROM Professores p WHERE p.status = :status")})
public class Professores implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_Professores")
    private Integer idProfessores;
    @Basic(optional = false)
    @Column(name = "nome")
    private String nome;
    @Basic(optional = false)
    @Column(name = "descricao_Academica")
    private String descricaoAcademica;
    @Basic(optional = false)
    @Column(name = "data_Admissao")
    @Temporal(TemporalType.DATE)
    private Date dataAdmissao;
    @Lob
    @Column(name = "imagem")
    private byte[] imagem;
    @Basic(optional = false)
    @Column(name = "status")
    private String status;
    @JoinTable(name = "professores_curso", joinColumns = {
        @JoinColumn(name = "id_Professores", referencedColumnName = "id_Professores")}, inverseJoinColumns = {
        @JoinColumn(name = "id_Curso", referencedColumnName = "id_Curso")})
    @ManyToMany
    private List<Curso> cursoList;
    @JoinColumn(name = "email", referencedColumnName = "email")
    @ManyToOne(optional = false)
    private Login login;
//    @OneToMany(cascade = CascadeType.ALL, mappedBy = "professores")
//    private List<Curso> cursoList1;

    public Professores() {
    }

    public Professores(Integer idProfessores) {
        this.idProfessores = idProfessores;
    }

    public Professores(Integer idProfessores, String nome, String descricaoAcademica, Date dataAdmissao, String status) {
        this.idProfessores = idProfessores;
        this.nome = nome;
        this.descricaoAcademica = descricaoAcademica;
        this.dataAdmissao = dataAdmissao;
        this.status = status;
    }

    public Integer getIdProfessores() {
        return idProfessores;
    }

    public void setIdProfessores(Integer idProfessores) {
        this.idProfessores = idProfessores;
    }

    public String getNome() {
        return nome;
    }

    public void setNome(String nome) {
        this.nome = nome;
    }

    public String getDescricaoAcademica() {
        return descricaoAcademica;
    }

    public void setDescricaoAcademica(String descricaoAcademica) {
        this.descricaoAcademica = descricaoAcademica;
    }

    public Date getDataAdmissao() {
        return dataAdmissao;
    }

    public void setDataAdmissao(Date dataAdmissao) {
        this.dataAdmissao = dataAdmissao;
    }

    public byte[] getImagem() {
        return imagem;
    }

    public void setImagem(byte[] imagem) {
        this.imagem = imagem;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public List<Curso> getCursoList() {
        return cursoList;
    }

    public void setCursoList(List<Curso> cursoList) {
        this.cursoList = cursoList;
    }

    public Login getLogin() {
        return login;
    }

    public void setLogin(Login login) {
        this.login = login;
    }

//    public List<Curso> getCursoList1() {
//        return cursoList1;
//    }
//
//    public void setCursoList1(List<Curso> cursoList1) {
//        this.cursoList1 = cursoList1;
//    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idProfessores != null ? idProfessores.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Professores)) {
            return false;
        }
        Professores other = (Professores) object;
        if ((this.idProfessores == null && other.idProfessores != null) || (this.idProfessores != null && !this.idProfessores.equals(other.idProfessores))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "admin.model.Professores[idProfessores=" + idProfessores + "]";
    }

}
